package gui;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JOptionPane;

@SuppressWarnings("serial")
public class SaveButton extends JButton {
	JButton myButton;
	String[] myOptions = {"Save Changes", 
			"Do Not Save Changes"};
	public SaveButton() {
		myButton = new JButton( 
		new AbstractAction("Save") {
			@Override
			public void actionPerformed(ActionEvent e) {
				int selection = 0;
					JOptionPane.showOptionDialog(null, 
							"Save Current Changes?", 
							"Save", 
							JOptionPane.OK_CANCEL_OPTION, 
							JOptionPane.QUESTION_MESSAGE, 
							null, 
							myOptions, 
							0);
					
				switch (selection) {
				case 0:
					// save conference logic here.
					// I think that this Object needs reference to the object to be saved (a conference Object)
					// and some object that has a method that it can call to "save the data".
					// This might be the GuiController or some other SaveConference Class
					
					break;
				case 1:
					// do nothing
					break;
				}
			}
		});
	}
	public JButton getButton() {
		return myButton;
	}
}
